package sudroid.security;

public class SHA1
{
  private final int[] abcde;
  private int[] digestInt;
  private int[] tmpData;

  public SHA1()
  {
    int[] arrayOfInt1 = { 1732584193, -271733879, -1732584194, 271733878, -1009589776 };
    this.abcde = arrayOfInt1;
    int[] arrayOfInt2 = new int[5];
    this.digestInt = arrayOfInt2;
    int[] arrayOfInt3 = new int[80];
    this.tmpData = arrayOfInt3;
  }

  private byte[] byteArrayFormatData(byte[] paramArrayOfByte)
  {
    int i = paramArrayOfByte.length;
    int j = i % 64;
    int k = j;
    int m = 56;
    int n;
    int i1;
    byte[] arrayOfByte1;
    int i6;
    int i7;
    if (k < m)
    {
      n = 55 - j;
      i1 = i - j + 64;
      arrayOfByte1 = new byte[i1];
      byte[] arrayOfByte2 = paramArrayOfByte;
      int i2 = 0;
      byte[] arrayOfByte3 = arrayOfByte1;
      int i3 = 0;
      int i4 = i;
      System.arraycopy(arrayOfByte2, i2, arrayOfByte3, i3, i4);
      int i5 = i;
      i6 = i5 + 1;
      arrayOfByte1[i5] = 65408;
      i7 = 0;
    }
    while (true)
    {
      int i8 = i7;
      int i9 = n;
      if (i8 >= i9)
      {
        long l = i * 8L;
        int i10 = (byte)(int)(0xFF & l);
        int i11 = (byte)(int)(l >> 8 & 0xFF);
        int i12 = (byte)(int)(l >> 16 & 0xFF);
        int i13 = (byte)(int)(l >> 24 & 0xFF);
        int i14 = (byte)(int)(l >> 32 & 0xFF);
        int i15 = (byte)(int)(l >> 40 & 0xFF);
        int i16 = (byte)(int)(l >> 48 & 0xFF);
        int i17 = (byte)(int)(l >> 56);
        int i18 = i6 + 1;
        arrayOfByte1[i6] = i17;
        int i19 = i18 + 1;
        arrayOfByte1[i18] = i16;
        int i20 = i19 + 1;
        arrayOfByte1[i19] = i15;
        int i21 = i20 + 1;
        arrayOfByte1[i20] = i14;
        int i22 = i21 + 1;
        arrayOfByte1[i21] = i13;
        int i23 = i22 + 1;
        arrayOfByte1[i22] = i12;
        int i24 = i23 + 1;
        arrayOfByte1[i23] = i11;
        int i25 = i24 + 1;
        arrayOfByte1[i24] = i10;
        return arrayOfByte1;
        int i26 = j;
        int i27 = 56;
        if (i26 == i27)
        {
          n = 63;
          i1 = i + 8 + 64;
          break;
        }
        n = 63 - j + 56;
        i1 = i + 64 - j + 64;
        break;
      }
      int i28 = i6 + 1;
      arrayOfByte1[i6] = 0;
      i7 += 1;
      i6 = i28;
    }
  }

  private static String byteArrayToHexString(byte[] paramArrayOfByte)
  {
    String str1 = "";
    int i = 0;
    while (true)
    {
      int j = paramArrayOfByte.length;
      if (i >= j)
        return str1;
      String str2 = String.valueOf(str1);
      StringBuilder localStringBuilder = new StringBuilder(str2);
      String str3 = byteToHexString(paramArrayOfByte[i]);
      str1 = str3;
      i += 1;
    }
  }

  private int byteArrayToInt(byte[] paramArrayOfByte, int paramInt)
  {
    int i = (paramArrayOfByte[paramInt] & 0xFF) << 24;
    int j = paramInt + 1;
    int k = (paramArrayOfByte[j] & 0xFF) << 16;
    int m = i | k;
    int n = paramInt + 2;
    int i1 = (paramArrayOfByte[n] & 0xFF) << 8;
    int i2 = m | i1;
    int i3 = paramInt + 3;
    int i4 = paramArrayOfByte[i3] & 0xFF;
    return i2 | i4;
  }

  private static String byteToHexString(byte paramByte)
  {
    char[] arrayOfChar1 = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null };
    char[] arrayOfChar2 = new char[2];
    int i = paramByte >>> 4 & 0xF;
    int j = arrayOfChar1[i];
    arrayOfChar2[0] = j;
    int k = paramByte & 0xF;
    int m = arrayOfChar1[k];
    arrayOfChar2[1] = m;
    return new String(arrayOfChar2);
  }

  private void encrypt()
  {
    int i = 16;
    int[] arrayOfInt1;
    int j;
    label15: int m;
    label28: int n;
    label39: int i1;
    label50: int i2;
    label61: int i3;
    label71: int i5;
    if (i > 79)
    {
      arrayOfInt1 = new int[5];
      j = 0;
      int k = arrayOfInt1.length;
      if (j < k)
        break label224;
      m = 0;
      if (m <= 19)
        break label244;
      n = 20;
      if (n <= 39)
        break label387;
      i1 = 40;
      if (i1 <= 59)
        break label530;
      i2 = 60;
      if (i2 <= 79)
        break label673;
      i3 = 0;
      int i4 = arrayOfInt1.length;
      if (i3 < i4)
        break label816;
      i5 = 0;
    }
    while (true)
    {
      int i6 = this.tmpData.length;
      if (i5 >= i6)
      {
        return;
        int[] arrayOfInt2 = this.tmpData;
        int[] arrayOfInt3 = this.tmpData;
        int i7 = i - 3;
        int i8 = arrayOfInt3[i7];
        int[] arrayOfInt4 = this.tmpData;
        int i9 = i - 8;
        int i10 = arrayOfInt4[i9];
        int i11 = i8 ^ i10;
        int[] arrayOfInt5 = this.tmpData;
        int i12 = i - 14;
        int i13 = arrayOfInt5[i12];
        int i14 = i11 ^ i13;
        int[] arrayOfInt6 = this.tmpData;
        int i15 = i - 16;
        int i16 = arrayOfInt6[i15];
        int i17 = i14 ^ i16;
        int i18 = f4(i17, 1);
        arrayOfInt2[i] = i18;
        i += 1;
        break;
        label224: int i19 = this.digestInt[j];
        arrayOfInt1[j] = i19;
        j += 1;
        break label15;
        label244: int i20 = arrayOfInt1[0];
        int i21 = f4(i20, 5);
        int i22 = arrayOfInt1[1];
        int i23 = arrayOfInt1[2];
        int i24 = arrayOfInt1[3];
        int i25 = f1(i22, i23, i24);
        int i26 = i21 + i25;
        int i27 = arrayOfInt1[4];
        int i28 = i26 + i27;
        int i29 = this.tmpData[m];
        int i30 = i28 + i29 + 1518500249;
        int i31 = arrayOfInt1[3];
        arrayOfInt1[4] = i31;
        int i32 = arrayOfInt1[2];
        arrayOfInt1[3] = i32;
        int i33 = arrayOfInt1[1];
        int i34 = f4(i33, 30);
        arrayOfInt1[2] = i34;
        int i35 = arrayOfInt1[0];
        arrayOfInt1[1] = i35;
        arrayOfInt1[0] = i30;
        m += 1;
        break label28;
        label387: int i36 = arrayOfInt1[0];
        int i37 = f4(i36, 5);
        int i38 = arrayOfInt1[1];
        int i39 = arrayOfInt1[2];
        int i40 = arrayOfInt1[3];
        int i41 = f2(i38, i39, i40);
        int i42 = i37 + i41;
        int i43 = arrayOfInt1[4];
        int i44 = i42 + i43;
        int i45 = this.tmpData[n];
        int i46 = i44 + i45 + 1859775393;
        int i47 = arrayOfInt1[3];
        arrayOfInt1[4] = i47;
        int i48 = arrayOfInt1[2];
        arrayOfInt1[3] = i48;
        int i49 = arrayOfInt1[1];
        int i50 = f4(i49, 30);
        arrayOfInt1[2] = i50;
        int i51 = arrayOfInt1[0];
        arrayOfInt1[1] = i51;
        arrayOfInt1[0] = i46;
        n += 1;
        break label39;
        label530: int i52 = arrayOfInt1[0];
        int i53 = f4(i52, 5);
        int i54 = arrayOfInt1[1];
        int i55 = arrayOfInt1[2];
        int i56 = arrayOfInt1[3];
        int i57 = f3(i54, i55, i56);
        int i58 = i53 + i57;
        int i59 = arrayOfInt1[4];
        int i60 = i58 + i59;
        int i61 = this.tmpData[i1];
        int i62 = i60 + i61 + -1894007588;
        int i63 = arrayOfInt1[3];
        arrayOfInt1[4] = i63;
        int i64 = arrayOfInt1[2];
        arrayOfInt1[3] = i64;
        int i65 = arrayOfInt1[1];
        int i66 = f4(i65, 30);
        arrayOfInt1[2] = i66;
        int i67 = arrayOfInt1[0];
        arrayOfInt1[1] = i67;
        arrayOfInt1[0] = i62;
        i1 += 1;
        break label50;
        label673: int i68 = arrayOfInt1[0];
        int i69 = f4(i68, 5);
        int i70 = arrayOfInt1[1];
        int i71 = arrayOfInt1[2];
        int i72 = arrayOfInt1[3];
        int i73 = f2(i70, i71, i72);
        int i74 = i69 + i73;
        int i75 = arrayOfInt1[4];
        int i76 = i74 + i75;
        int i77 = this.tmpData[i2];
        int i78 = i76 + i77 + -899497514;
        int i79 = arrayOfInt1[3];
        arrayOfInt1[4] = i79;
        int i80 = arrayOfInt1[2];
        arrayOfInt1[3] = i80;
        int i81 = arrayOfInt1[1];
        int i82 = f4(i81, 30);
        arrayOfInt1[2] = i82;
        int i83 = arrayOfInt1[0];
        arrayOfInt1[1] = i83;
        arrayOfInt1[0] = i78;
        i2 += 1;
        break label61;
        label816: int[] arrayOfInt7 = this.digestInt;
        int i84 = this.digestInt[i3];
        int i85 = arrayOfInt1[i3];
        int i86 = i84 + i85;
        arrayOfInt7[i3] = i86;
        i3 += 1;
        break label71;
      }
      this.tmpData[i5] = 0;
      i5 += 1;
    }
  }

  private int f1(int paramInt1, int paramInt2, int paramInt3)
  {
    int i = paramInt1 & paramInt2;
    int j = (paramInt1 ^ 0xFFFFFFFF) & paramInt3;
    return i | j;
  }

  private int f2(int paramInt1, int paramInt2, int paramInt3)
  {
    return paramInt1 ^ paramInt2 ^ paramInt3;
  }

  private int f3(int paramInt1, int paramInt2, int paramInt3)
  {
    int i = paramInt1 & paramInt2;
    int j = paramInt1 & paramInt3;
    int k = i | j;
    int m = paramInt2 & paramInt3;
    return k | m;
  }

  private int f4(int paramInt1, int paramInt2)
  {
    int i = paramInt1 << paramInt2;
    int j = 32 - paramInt2;
    int k = paramInt1 >>> j;
    return i | k;
  }

  private void intToByteArray(int paramInt1, byte[] paramArrayOfByte, int paramInt2)
  {
    int i = (byte)(paramInt1 >>> 24);
    paramArrayOfByte[paramInt2] = i;
    int j = paramInt2 + 1;
    int k = (byte)(paramInt1 >>> 16);
    paramArrayOfByte[j] = k;
    int m = paramInt2 + 2;
    int n = (byte)(paramInt1 >>> 8);
    paramArrayOfByte[m] = n;
    int i1 = paramInt2 + 3;
    int i2 = (byte)paramInt1;
    paramArrayOfByte[i1] = i2;
  }

  private int process_input_bytes(byte[] paramArrayOfByte)
  {
    int[] arrayOfInt1 = this.abcde;
    int[] arrayOfInt2 = this.digestInt;
    int i = this.abcde.length;
    System.arraycopy(arrayOfInt1, 0, arrayOfInt2, 0, i);
    byte[] arrayOfByte = byteArrayFormatData(paramArrayOfByte);
    int j = arrayOfByte.length / 64;
    int k = 0;
    if (k >= j)
      return 20;
    int m = 0;
    while (true)
    {
      if (m >= 16)
      {
        encrypt();
        k += 1;
        break;
      }
      int[] arrayOfInt3 = this.tmpData;
      int n = k * 64;
      int i1 = m * 4;
      int i2 = n + i1;
      int i3 = byteArrayToInt(arrayOfByte, i2);
      arrayOfInt3[m] = i3;
      m += 1;
    }
  }

  public static String toSHA1(String paramString)
  {
    SHA1 localSHA1 = new SHA1();
    byte[] arrayOfByte = paramString.getBytes();
    return localSHA1.getDigestOfString(arrayOfByte);
  }

  public byte[] getDigestOfBytes(byte[] paramArrayOfByte)
  {
    int i = process_input_bytes(paramArrayOfByte);
    byte[] arrayOfByte = new byte[20];
    int j = 0;
    while (true)
    {
      int k = this.digestInt.length;
      if (j >= k)
        return arrayOfByte;
      int m = this.digestInt[j];
      int n = j * 4;
      intToByteArray(m, arrayOfByte, n);
      j += 1;
    }
  }

  public String getDigestOfString(byte[] paramArrayOfByte)
  {
    return byteArrayToHexString(getDigestOfBytes(paramArrayOfByte));
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.security.SHA1
 * JD-Core Version:    0.6.0
 */